package net.roostertech.bta2dpfixer;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DeviceSQLiteHelper extends SQLiteOpenHelper {
	private static final String DATABASE_NAME = "devices.db";
	private static final int DATABASE_VERSION = 1;
	
	public static final String DEVICES_TBL = "devices";
	public static final String COLUMN_ID = "_id";
	public static final String COLUMN_DEVICE_NAME = "deviceName";

	
	private static final String DATABASE_CREATE = "create table "
		+ DEVICES_TBL + "( " + COLUMN_ID
		+ " integer primary key autoincrement, " + COLUMN_DEVICE_NAME
		+ " text not null);";
	
	public DeviceSQLiteHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase database) {
		database.execSQL(DATABASE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + DEVICES_TBL);
        onCreate(db);
	}

}
